Declaration Is Hidden (DIH)

Description:

DIH detects declarations that hide other visible declarations. These are:

Incorrect:

public class Container {
    private int size;
    
    public void copyFrom(Container c) {
        int size = c.size;
        ...
    }
}

Correct:

public class Container {
    private int size;
    
    public void copyFrom(Container c) {
        int newSize = c.size;
        ...
    }
}

Incorrect:

public class Window {
    protected int style;

    public static Window Create(...) {
        ...
    }
}

public class Button : Window {
    protected int style;

    public static Button Create(...) {
        ...
    }
}

Correct:

public class Window {
    protected int style;

    public static Window CreateWindow(...) {
        ...
    }
}

public class Button : Window {
    protected int extendedStyle;

    public static Button CreateButton(...) {
        ...
    }
}

Refactoring: